/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DBClasses;

/**
 *A class that allows the program to keep track of matching items in a search.
 * @author hendrikde
 */
public class SearchNode implements Comparable<SearchNode>{
    //Stores all words that could be keywords (eg a circle's name, type, and owner)
    private String words;
    private String[] wordsSplit;
    //Number of "hits"
    private int count;
    //ID of the entity
    private int id;
    
    public SearchNode(String[] w, int i) {
        wordsSplit = w;
        words = new String();
        for (int r = 0; r < w.length; r++)
            words = words + " " +w[r];
        id = i;
        count = 0;
    }
    
    public void increment() {
        count++;
    }
    
    public int getCount() {
        return count;
    }
    
    public int getID() {
        return id;
    }
    
    public String getWords() {
        return words;
    }
    
    public String[] getWordsSplit() {
        return wordsSplit;
    }
    
    @Override
    public int compareTo(SearchNode o) {
        return -1*(this.getCount() - o.getCount());
    }
}
